package com.sky.skyopsserver.enums;

import com.sky.skyopsserver.exception.BaseExceptionInterface;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ResponseCodeEnum implements BaseExceptionInterface {
    // ----------- 通用异常状态码 -----------
    SYSTEM_ERROR("10000", "出错啦，后台小哥正在努力修复中..."),
    PARAM_NOT_VALID("10001", "参数错误"),

    CHAT_NOT_EXISTED("20000", "此对话不存在"),
    
    // ----------- 机房模块异常状态码 -----------
    COMPUTER_ROOM_NAME_EXISTS("30001", "机房名称已存在"),
    COMPUTER_ROOM_NOT_EXISTS("30002", "机房不存在"),
    COMPUTER_ROOM_ADD_FAILED("30003", "添加机房失败"),
    COMPUTER_ROOM_UPDATE_FAILED("30004", "更新机房失败"),
    COMPUTER_ROOM_DELETE_FAILED("30005", "删除机房失败"),
    
    // ----------- 主机模块异常状态码 -----------
    HOST_NAME_EXISTS("37001", "主机名称已存在"),
    HOST_NOT_EXISTS("37002", "主机不存在"),
    HOST_ADD_FAILED("37003", "添加主机失败"),
    HOST_UPDATE_FAILED("37004", "更新主机失败"),
    HOST_DELETE_FAILED("37005", "删除主机失败"),
    HOST_IP_EXISTS("37006", "主机IP地址已存在"),
    HOST_IP_INVALID("37007", "主机IP地址格式无效"),
    HOST_PORT_INVALID("37008", "主机端口无效"),
    HOST_ROOM_NOT_EXISTS("37009", "所属机房不存在"),
    HOST_GROUP_NOT_EXISTS("37010", "所属主机组不存在"),
    HOST_TYPE_INVALID("37011", "主机类型无效"),
    HOST_CONNECTION_FAILED("37012", "主机连接失败"),
    
    // ----------- 主机组模块异常状态码 -----------
    HOST_GROUP_NAME_EXISTS("31001", "主机组名称已存在"),
    HOST_GROUP_ADD_FAILED("31003", "添加主机组失败"),
    HOST_GROUP_UPDATE_FAILED("31004", "更新主机组失败"),
    HOST_GROUP_DELETE_FAILED("31005", "删除主机组失败"),
    HOST_GROUP_HAS_HOSTS("31006", "主机组下还有主机，无法删除"),
    HOST_NOT_IN_GROUP("31008", "主机不属于指定主机组"),
    
    // ----------- 环境模块异常状态码 -----------
    ENVIRONMENT_CODE_EXISTS("32001", "环境编码已存在"),
    ENVIRONMENT_NAME_EXISTS("32002", "环境名称已存在"),
    ENVIRONMENT_NOT_EXISTS("32003", "环境不存在"),
    ENVIRONMENT_ADD_FAILED("32004", "添加环境失败"),
    ENVIRONMENT_UPDATE_FAILED("32005", "更新环境失败"),
    ENVIRONMENT_DELETE_FAILED("32006", "删除环境失败"),
    ENVIRONMENT_IN_USE("32007", "环境正在使用中，无法删除"),
    ENVIRONMENT_CODE_INVALID("32008", "环境编码格式不正确"),
    
    // ----------- 凭据模块异常状态码 -----------
    CREDENTIAL_NAME_EXISTS("33001", "凭据名称已存在"),
    CREDENTIAL_NOT_EXISTS("33002", "凭据不存在"),
    CREDENTIAL_ADD_FAILED("33003", "添加凭据失败"),
    CREDENTIAL_UPDATE_FAILED("33004", "更新凭据失败"),
    CREDENTIAL_DELETE_FAILED("33005", "删除凭据失败"),
    CREDENTIAL_IN_USE("33006", "凭据正在使用中，无法删除"),
    CREDENTIAL_TYPE_INVALID("33007", "凭据类型无效"),
    CREDENTIAL_PASSWORD_REQUIRED("33008", "密码认证方式必须提供密码"),
    CREDENTIAL_SECRET_KEY_REQUIRED("33009", "密钥认证方式必须提供密钥"),
    CREDENTIAL_DECRYPT_FAILED("33010", "凭据解密失败"),
    CREDENTIAL_ENCRYPT_FAILED("33011", "凭据加密失败"),
    
    // ----------- 项目模块异常状态码 -----------
    PROJECT_CODE_EXISTS("34001", "项目编码已存在"),
    PROJECT_NAME_EXISTS("34002", "项目名称已存在"),
    PROJECT_NOT_EXISTS("34003", "项目不存在"),
    PROJECT_ADD_FAILED("34004", "添加项目失败"),
    PROJECT_UPDATE_FAILED("34005", "更新项目失败"),
    PROJECT_DELETE_FAILED("34006", "删除项目失败"),
    PROJECT_HAS_APPLICATIONS("34007", "项目下还有应用，无法删除"),
    PROJECT_CODE_INVALID("34008", "项目编码格式不正确"),
    
    // ----------- 通知模块异常状态码 -----------
    NOTIFICATION_NAME_EXISTS("35001", "通知名称已存在"),
    NOTIFICATION_NOT_EXISTS("35002", "通知不存在"),
    NOTIFICATION_ADD_FAILED("35003", "添加通知失败"),
    NOTIFICATION_UPDATE_FAILED("35004", "更新通知失败"),
    NOTIFICATION_DELETE_FAILED("35005", "删除通知失败"),
    NOTIFICATION_TYPE_INVALID("35006", "通知方式无效"),
    NOTIFICATION_EMAIL_INVALID("35007", "邮箱格式无效"),
    NOTIFICATION_WEBHOOK_INVALID("35008", "Webhook地址无效"),
    
    // ----------- 应用模块异常状态码 -----------
    APPLICATION_CODE_EXISTS("36001", "应用编码已存在"),
    APPLICATION_NAME_EXISTS("36002", "应用名称已存在"),
    APPLICATION_NOT_EXISTS("36003", "应用不存在"),
    APPLICATION_ADD_FAILED("36004", "添加应用失败"),
    APPLICATION_UPDATE_FAILED("36005", "更新应用失败"),
    APPLICATION_DELETE_FAILED("36006", "删除应用失败"),
    APPLICATION_CODE_INVALID("36007", "应用编码格式不正确"),
    APPLICATION_PROJECT_NOT_EXISTS("36008", "所属项目不存在"),
    
    APPLICATION_NOT_IN_PROJECT("36001","应用不存在项目中" );

    // 异常码
    private final String errorCode;
    // 错误信息
    private final String errorMessage;
}
